//定义一个测试类GeometricTest，
//编写equalsArea方法测试两个对象的面积是否相等（注意方法的参数类型），
//编写displayGeometricObject方法显示对象的面积（注意方法的参数类型）。
public class GeometriTest {
    public static void main(String[] args) {


        GeometricObject g1 = new Circle("red",2.0,2.3);
        GeometricObject g2 = new Circle("red",2.0,2.3);
        GeometricObject g3 = new MyRectangle("blue",3.0,4.5,3.7);

        GeometriTest test = new GeometriTest();
        boolean isEqual = test.equalsArea(g1,g2);
        if (isEqual == true){
            System.out.println("面积相等");
        }else{
            System.out.println("面积不相等");
        }
        test.displayGeometricObject(g2);
        test.displayGeometricObject(g3);

        //使用匿名对象
        test.displayGeometricObject(new MyRectangle("blue",2.0,3.2,4.0));
    }


        //比较两个图形面积是否相等 ,true相等 ,false不想等
        public boolean equalsArea(GeometricObject g1,GeometricObject g2){
            return g1.findArea() == g2.findArea();

//            GeometricObject g1 = new Circle();
//            GeometricObject g2 = new GeometricObject()
        }
        public void displayGeometricObject(GeometricObject g){
            System.out.println("几何图形的面积为" + g.findArea());
//            GeometricObject g1 = new Circle();
//            GeometricObject g2 = new MyRectangle();
        }
}


